home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / NET / NDISC.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  3KB  |  124 lines

  1. #ifndef _NDISC_H
  2. #define _NDISC_H
  3.  
  4. /*
  5.  *    ICMP codes for neighbour discovery messages
  6.  */
  7.  
  8. #define NDISC_ROUTER_SOLICITATION    133
  9. #define NDISC_ROUTER_ADVERTISEMENT    134
  10. #define NDISC_NEIGHBOUR_SOLICITATION    135
  11. #define NDISC_NEIGHBOUR_ADVERTISEMENT    136
  12. #define NDISC_REDIRECT            137
  13.  
  14. /*
  15.  *    ndisc options
  16.  */
  17.  
  18. #define ND_OPT_SOURCE_LL_ADDR        1
  19. #define ND_OPT_TARGET_LL_ADDR        2
  20. #define ND_OPT_PREFIX_INFO        3
  21. #define ND_OPT_REDIRECT_HDR        4
  22. #define ND_OPT_MTU            5
  23.  
  24. #define MAX_RTR_SOLICITATION_DELAY    HZ
  25.  
  26. #define ND_REACHABLE_TIME        (30*HZ)
  27. #define ND_RETRANS_TIMER        HZ
  28.  
  29. #define ND_MIN_RANDOM_FACTOR        (1/2)
  30. #define ND_MAX_RANDOM_FACTOR        (3/2)
  31.  
  32. #ifdef __KERNEL__
  33.  
  34. #include <linux/skbuff.h>
  35. #include <linux/netdevice.h>
  36. #include <linux/icmpv6.h>
  37. #include <net/neighbour.h>
  38. #include <asm/atomic.h>
  39.  
  40. extern struct neigh_table nd_tbl;
  41.  
  42. struct nd_msg {
  43.         struct icmp6hdr    icmph;
  44.         struct in6_addr    target;
  45.         struct {
  46.                 __u8    opt_type;
  47.                 __u8    opt_len;
  48.                 __u8    link_addr[MAX_ADDR_LEN];
  49.         } opt;
  50. };
  51.  
  52. struct ra_msg {
  53.         struct icmp6hdr        icmph;
  54.     __u32            reachable_time;
  55.     __u32            retrans_timer;
  56. };
  57.  
  58.  
  59. extern int            ndisc_init(struct net_proto_family *ops);
  60.  
  61. extern void            ndisc_cleanup(void);
  62.  
  63. extern int            ndisc_rcv(struct sk_buff *skb, unsigned long len);
  64.  
  65. extern void            ndisc_send_ns(struct device *dev,
  66.                           struct neighbour *neigh,
  67.                           struct in6_addr *solicit,
  68.                           struct in6_addr *daddr,
  69.                           struct in6_addr *saddr);
  70.  
  71. extern void            ndisc_send_rs(struct device *dev,
  72.                           struct in6_addr *saddr,
  73.                           struct in6_addr *daddr);
  74.  
  75. extern void            ndisc_forwarding_on(void);
  76. extern void            ndisc_forwarding_off(void);
  77.  
  78. extern void            ndisc_send_redirect(struct sk_buff *skb,
  79.                             struct neighbour *neigh,
  80.                             struct in6_addr *target);
  81.  
  82. extern int            ndisc_mc_map(struct in6_addr *addr, char *buf, struct device *dev, int dir);
  83.  
  84.  
  85. struct rt6_info *        dflt_rt_lookup(void);
  86.  
  87. /*
  88.  *    IGMP
  89.  */
  90. extern int            igmp6_init(struct net_proto_family *ops);
  91.  
  92. extern void            igmp6_cleanup(void);
  93.  
  94. extern int            igmp6_event_query(struct sk_buff *skb,
  95.                           struct icmp6hdr *hdr,
  96.                           int len);
  97.  
  98. extern int            igmp6_event_report(struct sk_buff *skb,
  99.                            struct icmp6hdr *hdr,
  100.                            int len);
  101.  
  102. extern void            igmp6_cleanup(void);
  103.  
  104. extern __inline__ struct neighbour * ndisc_get_neigh(struct device *dev, struct in6_addr *addr)
  105. {
  106.  
  107.     if (dev) {
  108.         struct neighbour *neigh;
  109.  
  110.         start_bh_atomic();
  111.         neigh = __neigh_lookup(&nd_tbl, addr, dev, 1);
  112.         end_bh_atomic();
  113.  
  114.         return neigh;
  115.     }
  116.     return NULL;
  117. }
  118.  
  119.  
  120. #endif /* __KERNEL__ */
  121.  
  122.  
  123. #endif
  124.